<template>
  <amap :default-value="postForm.detailedAddress" @getPosition="getPosition" />
</template>
<script>
import Amap from '@/components/Amap'
export default {
  components: {
    Amap
  },
  data: function() {
    return {
      postForm: {
        detailedAddress: '',
        longitude: '',
        latitude: ''
      }
    }
  },
  methods: {
    // 获取地址信息
    getPosition({ address, lat, lng, name }) {
      this.postForm.detailedAddress = address
      this.postForm.longitude = String(lng)
      this.postForm.latitude = String(lat)
    }
  }
}
</script>
